import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function register(data) {
  return request({
    url: '/user/register',
    method: 'post',
    data
  })
}

export function getUserInfo() {
  return request({
    url: '/user/info',
    method: 'get'
  })
}

export function updateUserInfo(data) {
  return request({
    url: '/user/info',
    method: 'put',
    data
  })
}

export function changePassword(data) {
  return request({
    url: '/user/password',
    method: 'put',
    data
  })
}

export function updatePoints(userId, points) {
  return request({
    url: '/user/points',
    method: 'put',
    params: { userId, points }
  })
}

export function getUserList(params) {
  return request({
    url: '/user/list',
    method: 'get',
    params
  })
}

export function updateUser(userId, data) {
  return request({
    url: `/user/${userId}`,
    method: 'put',
    data
  })
}

export function resetUserPassword(userId, newPassword) {
  return request({
    url: `/user/${userId}/password`,
    method: 'put',
    data: { newPassword }
  })
}

export function toggleUserStatus(userId) {
  return request({
    url: `/user/${userId}/status`,
    method: 'put'
  })
} 